<template>
  <div class="progress">
    <div class="progress-item" v-for="(item, i) in data" :key="i">
      <div class="item-name">{{ item.name }}</div>
      <div class="item-content" :class="getCheck(item.value) ? '' : 'below'">
        <el-progress
          :percentage="Number(item.value)"
          :color="getCheck(item.value) ? '#32D3DA' : '#FFA340FF'"
          :stroke-width="10"
        />
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
interface ProgressData {
  name: String;
  value: Number;
}
defineProps({
  data: {
    type: Array as () => ProgressData[],
    default: () => []
  }
});
const getCheck = data => {
  return !!(data && Number(data) > 10);
};
</script>

<style scoped lang="scss">
.progress {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;

  // justify-content: center;
  .progress-item {
    display: flex;
    flex: 1;
    align-items: center;
    font-size: 14px;
    .item-name {
      width: 140px;
      word-wrap: break-word;

      // overflow: hidden;
      // text-overflow: ellipsis;
      // white-space: nowrap;
    }
    .item-content {
      flex: 1;
      :deep(.el-progress__text) {
        font-weight: 700;
        color: #32d3da;
      }
    }
    .below {
      :deep(.el-progress__text) {
        font-weight: 700;
        color: #ffa340ff;
      }
    }
  }
}
</style>
